<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> 
	<title>Projet Batterie</title>
	<link rel="stylesheet" href="css/style1.css" type="text/css" media="screen" />
</head>
<body>
<?php
function post_to_url($url, $data) {
   $fields = '';
   foreach($data as $key => $value) { 
      $fields .= $key . '=' . $value . '&'; 
   }
   rtrim($fields, '&');

   $post = curl_init();

   curl_setopt($post, CURLOPT_URL, $url);
   curl_setopt($post, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($post, CURLOPT_POST, count($data));
   curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
   curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);

   $result = curl_exec($post);
	
   curl_close($post);
   
   return $result;
}




$data= array(
   'keywords' => 'astuce',
   'rub_code' => '27'
);

$res = post_to_url("http://www.crea-astuce.fr/recherche/", $data);
echo $res ;

?>

<body>
</html>